import org.jboss.cache.Cache;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
import org.jboss.cache.config.Configuration;



public class JBossTest {
	public static void main(String[] args){
		CacheFactory<String, String> cacheFactory = new DefaultCacheFactory<String, String>();
		Cache<String, String> cache = cacheFactory.createCache("org/flynenu/core/cache/jbosscache/local.xml");
		
		Configuration conf = cache.getConfiguration();
		
//		conf.setClusterName("Lionel");
		
		cache.create();
		cache.start();
		
		Node<String, String> root = cache.getRoot();
		
		Fqn<String> fqn = Fqn.fromString("/user/b");
		
		Node<String, String> subNode = root.addChild(fqn);
		subNode.put("aaa", "aaa");
		
		System.out.println(cache.get(fqn, "aaa"));
		System.out.println(root.getChild(Fqn.fromString("/user/b")).get("aaa"));
		
		cache.destroy();
		
//		cache.getChildrenNames(fqn);
		/*CacheFactory factory new DefaultCacheFactory();
		Cache cache = factory.createCache("/opt/configurations/cache-configuration.xml", false);
		Configuration config = cache.getConfiguration();*/
	}
}
